﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace xTeam.HengLe.Helper
{
    public static class HtmlMetaHelper
    {
        private const string _copyRight = "Power by Shinnos";
        /// <summary>
        /// 输出html标题
        /// </summary>
        /// <param name="html">HtmlHelper</param>
        /// <param name="title">title</param>
        /// <returns>html title</returns>
        public static string HtmlTitle(string title)
        {
            return HtmlTitle(title, null);
        }
        /// <summary>
        /// 输出html description
        /// </summary>
        /// <param name="html">HtmlHelper</param>
        /// <param name="description">Description</param>
        /// <returns>html description</returns>
        public static string HtmlTitle(string title, string keywords)
        {
            return HtmlTitle(title, keywords, null);
        }
        /// <summary>
        /// 输出HtmlkeyWords
        /// </summary>
        /// <param name="html">HtmlHelper</param>
        /// <param name="keywords">KeyWords</param>
        /// <returns>html keywords</returns>
        public static string HtmlTitle(string title, string keywords, string description)
        {

            StringBuilder sb = new StringBuilder();

            if (!string.IsNullOrEmpty(title))
                sb.Append(string.Format("<title>{0} - {1}</title>", title, _copyRight));

            if (!string.IsNullOrEmpty(keywords))
                sb.Append(string.Format("<meta name=\"keywords\" content=\"{0},{1}\"/>", keywords, _copyRight));


            if (!string.IsNullOrEmpty(description))
                sb.Append(string.Format("<meta name=\"description\" content=\"{0},{1}\"/>", description, _copyRight));

            return sb.ToString();

        }
    }
}
